UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AMHcyK7zqJYdjhAsyGA51cId94cvUMRkAvoeK/4CYsM='
WHERE
key_id = '41107959aa84e0c73ea7315545402dd971afbabf4a753fb69500389ba6820f58'
AND (
token = 'AMHcyK7zqJYdjhAsyGA51cId94cvUMRkAvoeK/4CYsM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)