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