UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JZNrzZVlGOnoq3AFJkyf4aQsIVKivC+3I1xyBZ2jQBQ=' 
WHERE 
  key_id = '871e78ff88bc51086a78a7927580f9d5fca399c419d93d1176587fe088637d6f' 
  AND (
    token = 'JZNrzZVlGOnoq3AFJkyf4aQsIVKivC+3I1xyBZ2jQBQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036