UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ML5k2+Ovv+KCwRTzo/VkT0Fj2E4R8OANy9VZ0tjcdw8=' 
WHERE 
  key_id = 'bf52a2b7893570c26e89c6cafa7a97850725997fae8332427e762896b143da0d' 
  AND (
    token = 'ML5k2+Ovv+KCwRTzo/VkT0Fj2E4R8OANy9VZ0tjcdw8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036