UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JBdLGGTjaQyB+ZawSBNy6YXR9OAE2zFX2LuGIVq2O9M=' 
WHERE 
  key_id = '8c25c2d9b621cdcf29ebfdc4b96d7718d3629c9cbfc2ca3f593f117bae8ceb59' 
  AND (
    token = 'JBdLGGTjaQyB+ZawSBNy6YXR9OAE2zFX2LuGIVq2O9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047