UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UZQirExrihnW4ANSXXawHvSDE5aDzCyXNCI5EO0QjC8='
WHERE
key_id = '085d2ae5227ee6c67070b20c9b37998d59f8c27204b0c5a175132c0208a78405'
AND (
token = 'UZQirExrihnW4ANSXXawHvSDE5aDzCyXNCI5EO0QjC8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)