UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '40yDae0A9gq81SvGfXqxmm7FE+sHjJZfgTW6e01rvzQ='
WHERE
key_id = '03976b2de78241aa718a0131a965111186f584b3883a2beec2b81eb355a19e59'
AND (
token = '40yDae0A9gq81SvGfXqxmm7FE+sHjJZfgTW6e01rvzQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)