UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hHinVR7fLSrty524nig+Y+AAwvOpm/3AVgo/tB2E1zc=' 
WHERE 
  key_id = '5f5cea8a4e07784bbe4a7a8241188634e2d9a4ed11fd588a02127dfad6f173e6' 
  AND (
    token = 'hHinVR7fLSrty524nig+Y+AAwvOpm/3AVgo/tB2E1zc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048