UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p3QucsvEekqJbqMiNkSTPuim7O1oD0h3fnyFTbk9Es4='
WHERE
key_id = 'dbabd8d22ab996f65b2e22e6fbda2ffae79161ad1f10ec8244906f937a824384'
AND (
token = 'p3QucsvEekqJbqMiNkSTPuim7O1oD0h3fnyFTbk9Es4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)