UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mDjbpgRfgZ4C+UwHzViYitsX3KV+giMekT7QxYaK++I=' 
WHERE 
  key_id = '9e781ff89302d5971492fbd4a137fe675b285d50b02e29a051c7109573481766' 
  AND (
    token = 'mDjbpgRfgZ4C+UwHzViYitsX3KV+giMekT7QxYaK++I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064