UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oHfhaz3u4YiAMbOQJqDIoARLYY5JPrk6FDe78upkegk='
WHERE
key_id = '1b3db21b40b916eb6337bf7e1153b998acbb98079091ed9ba37b16ff6b66bc3a'
AND (
token = 'oHfhaz3u4YiAMbOQJqDIoARLYY5JPrk6FDe78upkegk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)