UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UpYkm4yIr5FeuAiW3xtH2FCt5pkYdxNcoZeL+EtHo24=' 
WHERE 
  key_id = '4a361769f8a789538fd604636ab16e70df6714dd0ed15c60442bb27be1f55f16' 
  AND (
    token = 'UpYkm4yIr5FeuAiW3xtH2FCt5pkYdxNcoZeL+EtHo24=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044