UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wadQEBc7abAWUIhoONtfCGSlPDm2lEFiuCckwlzouEI='
WHERE
key_id = '96b956858abfd97baba3fa368090a10b3809f4c16a0f92980c1874c67f0d2edd'
AND (
token = 'wadQEBc7abAWUIhoONtfCGSlPDm2lEFiuCckwlzouEI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)