UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SrZg0i5R4uP2/YMapdPIvEl+IfSLMKxSaS/MVZYXgt4=' 
WHERE 
  key_id = '311196773da4bd02fa13a2e725f81f0be25a8d84c1aad6acec9a4f9e54193804' 
  AND (
    token = 'SrZg0i5R4uP2/YMapdPIvEl+IfSLMKxSaS/MVZYXgt4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031