UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ypd0VB2mC4K+NUzFf9/NR7ycI18BoYkupe7N8Aogtk4='
WHERE
key_id = '644038d9a926a802521ddf8cb710199e751c8e9137bb5cce73fa4d1598a014e2'
AND (
token = 'ypd0VB2mC4K+NUzFf9/NR7ycI18BoYkupe7N8Aogtk4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)