UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ln8TdtJ2MWH+A5MlMn4lG5arGC26cswsesT3BQMI4IY=' 
WHERE 
  key_id = '4563f81d0c44d8c72be70f1b2fa8a07523f7cc6561e752676b60109dd6ce1127' 
  AND (
    token = 'Ln8TdtJ2MWH+A5MlMn4lG5arGC26cswsesT3BQMI4IY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027