UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cK/MGAOuOLH+iv8xvO4J1X6WjzRvIAKiXzQEoIHKBgM='
WHERE
key_id = '474990fd4d44c54282fa646ca0fc5fbb74eea53d45b67f740163b3c9ea1181c0'
AND (
token = 'cK/MGAOuOLH+iv8xvO4J1X6WjzRvIAKiXzQEoIHKBgM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)