UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd+eOQpPr0BHvsGLl/mqZOC7bPvV2wOMEk4kTdWHwyzE=' 
WHERE 
  key_id = '26f627ebcbfa17286e437912f0e2f2f4e1e7884c72e1f495ddf53578ba011ae6' 
  AND (
    token = 'd+eOQpPr0BHvsGLl/mqZOC7bPvV2wOMEk4kTdWHwyzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038