UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5lcxu0Wx37M7orVzFTIoNGLK1SWdNw+aTLJ1d+OdOhQ=' 
WHERE 
  key_id = '51793a2b8c4eff7a5233760c042b69b7ff72c29704474aa7385b5b82e94e9f42' 
  AND (
    token = '5lcxu0Wx37M7orVzFTIoNGLK1SWdNw+aTLJ1d+OdOhQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038