UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HJbrCO6/kbZWB0PGUpRy9GoVS+gQ7IO+YMAQRed5ppw='
WHERE
key_id = '9b02ef347fb8a207997c8e108a697e1cc121b215e7c8765bd4677339d0d568b3'
AND (
token = 'HJbrCO6/kbZWB0PGUpRy9GoVS+gQ7IO+YMAQRed5ppw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)