UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p4T/rHjtSzQ2XS61gEAjLVo83PtoDpURI5cJtSj5Hvs='
WHERE
key_id = '6f3e6a97a47c98838ccd23eed25b334cd0749850741b9ed6dd80eeab140616e8'
AND (
token = 'p4T/rHjtSzQ2XS61gEAjLVo83PtoDpURI5cJtSj5Hvs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)