UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NZOXfcbenUIZMz6EnGNbvUsYoHbwXfgL5axk1hVK9gM='
WHERE
key_id = 'a6aca1cdf3ad8312aaf2396edec4bafc570140a1262cb9f6dc34219d1b5a790b'
AND (
token = 'NZOXfcbenUIZMz6EnGNbvUsYoHbwXfgL5axk1hVK9gM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)