UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'meYmTUGgFUHkvW7tKGg+72CNnVAR3y4iCCebcmu9/5c='
WHERE
key_id = 'a598ffe8090b81a8658746c054bac5bf501820f47355922e49fb85f4df2dc108'
AND (
token = 'meYmTUGgFUHkvW7tKGg+72CNnVAR3y4iCCebcmu9/5c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)