UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'McZdIpvskdWGKZA0/4J1r1R6lQ3R1FmWddhV+vSZVyw='
WHERE
key_id = 'abfa90065f6ad098d2451972e279f5da06bd00eba5f2d2d456ea8f0c378ac93d'
AND (
token = 'McZdIpvskdWGKZA0/4J1r1R6lQ3R1FmWddhV+vSZVyw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)