UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+oy18WNIU6GfJVHlj0K8xyFViWzS/K5PR4advdzHNhs=' 
WHERE 
  key_id = 'df87fa08ccf902b7f2933683b62aa0a302e184cccb2d16a2a060abe824b8e8c6' 
  AND (
    token = '+oy18WNIU6GfJVHlj0K8xyFViWzS/K5PR4advdzHNhs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049