UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HkcI4OSZQCRqQaKjk3VCtOa4LfiutZXyknp8yBRvlBM=' 
WHERE 
  key_id = '9dfc4a4f8b9f0f7345ab91559d026190f0d0e5e98399d427fc21ad68c1c1b922' 
  AND (
    token = 'HkcI4OSZQCRqQaKjk3VCtOa4LfiutZXyknp8yBRvlBM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030