UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NGhDu0eUpwaQQ6Rbrq6qFYWQ4HzGFkSy1x9DecvAz6o=' 
WHERE 
  key_id = '86a7ce0c711ecc0303f516eeba5912b89ea0d40d865bb60f01ad099c4bf4f38f' 
  AND (
    token = 'NGhDu0eUpwaQQ6Rbrq6qFYWQ4HzGFkSy1x9DecvAz6o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027