UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'faNGI8M4Wg4GXoVFGW/+FO40mVkcNPWMDthXKXlh0Wk='
WHERE
key_id = 'd60df94228520c789950036e46bb7d4d81277a6e1e80819285e64ef6e7fd6b09'
AND (
token = 'faNGI8M4Wg4GXoVFGW/+FO40mVkcNPWMDthXKXlh0Wk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)