UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GQ0Q27MRd8g6ExCNoEOgUWdbzEBR+554XO2uuj5wW/A=' 
WHERE 
  key_id = 'c18a9b85ae914a2b4953ee910a92f318a639651398df7ce5b21762f089d38986' 
  AND (
    token = 'GQ0Q27MRd8g6ExCNoEOgUWdbzEBR+554XO2uuj5wW/A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032