UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TMahrhRDD1qC1OfrBzmCxraLz5J2Brdb6Qhe5wH5UVI='
WHERE
key_id = 'b97da0c4a14bb10b6037316a5e74a21e054e4ba14c2f326fa9bb1448a4b2eb46'
AND (
token = 'TMahrhRDD1qC1OfrBzmCxraLz5J2Brdb6Qhe5wH5UVI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)