UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xCwsFcyOHZZ491viLiByuZD1pZ1YxsxItzcADGw24dc=' 
WHERE 
  key_id = '94f33b6b3f5c1939be3d4d790c1c96f42195a076294cc76882713a079429cda8' 
  AND (
    token = 'xCwsFcyOHZZ491viLiByuZD1pZ1YxsxItzcADGw24dc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019