UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sPiQajaLuU6ioJX0l7P3XeSNsdDjZ/Q2CFlFtdpzkD8='
WHERE
key_id = '33332b8ea5489ed01e235b47f8068f418a3d4a2151fbf0d33859897199c21880'
AND (
token = 'sPiQajaLuU6ioJX0l7P3XeSNsdDjZ/Q2CFlFtdpzkD8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)