UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '79d+aV39hno1bqoCIlYR7+vR/mqyv7lHrX8FOi2PJ40=' 
WHERE 
  key_id = '1541071d6f3eaf18cb1abfb1fdfd4b15a7124ca87abf63d4e9cc999feebd7e9e' 
  AND (
    token = '79d+aV39hno1bqoCIlYR7+vR/mqyv7lHrX8FOi2PJ40=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033