UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wv9QbZD7TAE6+Ni1LPzczZkouM4kcpdSTZtYmdqJW/U=' 
WHERE 
  key_id = '8e4a97c084f946245f8573a66f4f164b635cc6adeab134ca3cb57f83896ce350' 
  AND (
    token = 'Wv9QbZD7TAE6+Ni1LPzczZkouM4kcpdSTZtYmdqJW/U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032