UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qTeaLCb9x1IDtncKv5vIKl+ei01Dk9DWIYpHcY8j8GE='
WHERE
key_id = 'be2f2fe7f22cdbd4b0ccb0d3d0f46a84a45a604599cbdacd26066e854706bded'
AND (
token = 'qTeaLCb9x1IDtncKv5vIKl+ei01Dk9DWIYpHcY8j8GE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)