UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'It5F7O0hRcQQOUlZ7X1OarN9J4R4axyIlOHrjq7kKD0='
WHERE
key_id = '876c21d2a1230c98314e4650b976ff3ae8395a5393387c595469219defe2a60b'
AND (
token = 'It5F7O0hRcQQOUlZ7X1OarN9J4R4axyIlOHrjq7kKD0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)