UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B7KXChiR33+O8s6UAy5aKpr17v4PYvwFoSopfqZg5Dc='
WHERE
key_id = '3bda34a79f2d03e66eb72a0c0bd0113692a122b87ede702142da670347250af4'
AND (
token = 'B7KXChiR33+O8s6UAy5aKpr17v4PYvwFoSopfqZg5Dc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)