UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ctVJd16wACpziPNJvb80xOwfsp9CJgOh81vfe9JGBOM='
WHERE
key_id = '9a35bee4f1680af00bac72457ff132a3d145186452fba1f9940a46c16d03f3c1'
AND (
token = 'ctVJd16wACpziPNJvb80xOwfsp9CJgOh81vfe9JGBOM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)