UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uKYS8cz5+kCdmCLsUN0yyBd89/hKcJSzbbAucwgnoY4='
WHERE
key_id = '8ff35cfe293535bc613d151ac4eee00a8e9f20dbbbe0517a5a32ef656ed96ab3'
AND (
token = 'uKYS8cz5+kCdmCLsUN0yyBd89/hKcJSzbbAucwgnoY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)