UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6/P/oEmBFcUwp7t7clZreKm/Cg8Wp00zRwCX06cv8L4='
WHERE
key_id = 'ef427b6e1890f03bd46ff1d9d212e9237075fa29b8f795e9e8b4d985a4ea4719'
AND (
token = '6/P/oEmBFcUwp7t7clZreKm/Cg8Wp00zRwCX06cv8L4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)