UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BSCbyftKhpeoyvSefhTM5WMZwbeTwsttvLG01y/QoBA=' 
WHERE 
  key_id = '8f7aa2a078c318d4f538aa9580e1f4b594e4181254d201b969bb9498b2fd19b9' 
  AND (
    token = 'BSCbyftKhpeoyvSefhTM5WMZwbeTwsttvLG01y/QoBA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025