UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EDCJsPoLPgvazaQ6DqhYCyf4XiriaflXxjTyxgEHx8c=' 
WHERE 
  key_id = '268392c71713c54a59af04875a808156039f8c65a0f19adb259119904c0e0235' 
  AND (
    token = 'EDCJsPoLPgvazaQ6DqhYCyf4XiriaflXxjTyxgEHx8c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039