UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lHKyUU7jV7w5siCm2uPXifhMGw01MytuoePsfyn0RpA=' 
WHERE 
  key_id = '296c8b8e70887b8db30054d1cc7c9f7986e643ec6236aca111c2e226dffafd5f' 
  AND (
    token = 'lHKyUU7jV7w5siCm2uPXifhMGw01MytuoePsfyn0RpA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029