UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lsv24FFrQkD+L06l0d1xzOTMGSSMoTpCXXE0Z0y39+c=' 
WHERE 
  key_id = 'd237ee35f81bbf668f8b03cc7922d8d91a544f01f77e312b28750edcc6bfb956' 
  AND (
    token = 'Lsv24FFrQkD+L06l0d1xzOTMGSSMoTpCXXE0Z0y39+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043