UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i9jporv3hDJ9IzMbWuBbtIqaCIWddAXb5CqVqaert9c='
WHERE
key_id = '05188fc20c89c57404de4fad88d9d2e5d78b699edb2eebe9d5b55b3482c8fc19'
AND (
token = 'i9jporv3hDJ9IzMbWuBbtIqaCIWddAXb5CqVqaert9c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)