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