UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'USG/ZccpuEoeIKnzhZ6662DzkSYbJknBtfi53kzXzT8=' 
WHERE 
  key_id = 'b65bfdc85fe274cb798401162c30de1cb7e078732e32afc001aecef94122aeef' 
  AND (
    token = 'USG/ZccpuEoeIKnzhZ6662DzkSYbJknBtfi53kzXzT8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017