UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2EpIBSzE3YJXsvnWwHSF4atp/RNRQ8RdE2FrRs9q+Qo=' 
WHERE 
  key_id = '10defb258274ada4b5bee57a6ad6ce11f5e88cce2c835b6adc9b794ae7ea3af2' 
  AND (
    token = '2EpIBSzE3YJXsvnWwHSF4atp/RNRQ8RdE2FrRs9q+Qo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036