UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IhtCgSd2uuv5ndzH/DJuijyZ509FjoHr3sNvTSwCvcM='
WHERE
key_id = '8152b888fcb8df9cf707ab8127c05487c89d559204f52f433c2524a062fe6896'
AND (
token = 'IhtCgSd2uuv5ndzH/DJuijyZ509FjoHr3sNvTSwCvcM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)