UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tVosFMcENlDPE85Mjt24M5OsjkKoeCjODk1J4k+sUFk=' 
WHERE 
  key_id = '29600fcd4ef76e1d39e88fb9c5fe15a095a5068b094bef7849d76b88d40889ae' 
  AND (
    token = 'tVosFMcENlDPE85Mjt24M5OsjkKoeCjODk1J4k+sUFk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044