UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tDBluf7AEvG8iBf7UXG9HT3mWrJmcifwRmKFVvN31rs='
WHERE
key_id = '8658a2907bcd8ceb280e95ee2d127a9799ddabc9bf0c793e5264721c85fa167e'
AND (
token = 'tDBluf7AEvG8iBf7UXG9HT3mWrJmcifwRmKFVvN31rs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)