UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4IzQsT0MhAkcCZxfqAcd6/BZFS1GpQs7YKiBeesRO2Y='
WHERE
key_id = 'dc288500bb0ecbae696e2ff5f6ac3fc4ccc4b6ab15b1f8c38e54df4f64bd365d'
AND (
token = '4IzQsT0MhAkcCZxfqAcd6/BZFS1GpQs7YKiBeesRO2Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)