UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hR3/T/gvx21AhYQlv6Ln3T8fYcOC8kbUBpxJosWyFq4='
WHERE
key_id = '1bf39c11cef1bb32aced738e99fe67ea8e3d5d2a99e6e2a65735016148c7316c'
AND (
token = 'hR3/T/gvx21AhYQlv6Ln3T8fYcOC8kbUBpxJosWyFq4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)