UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RrkGw2bIuvnbLJ6GM3xZytuMS9YEg+DRCOYrqPf6OOc=' 
WHERE 
  key_id = 'dc455356bc1c0d283acc497efa1c55bcc7be73c57e73e523463c5d713c1f6302' 
  AND (
    token = 'RrkGw2bIuvnbLJ6GM3xZytuMS9YEg+DRCOYrqPf6OOc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021