UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DnGzMyBLZaOliD5cddLWn9LUhebPh4p6Sx2v2XxYwW4='
WHERE
key_id = '89451e351238116e405a26a21f613389ccd88a1f587225f3c2d4530cf8721afb'
AND (
token = 'DnGzMyBLZaOliD5cddLWn9LUhebPh4p6Sx2v2XxYwW4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)