UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pK39DNjY9emEfXlpsyQegfDNLoqYPYOZJgQSPabnIfY='
WHERE
key_id = '377330011aa9ee0ae35c8bb1e4013cecbb994858580a12a444f1b5b98b22dfe5'
AND (
token = 'pK39DNjY9emEfXlpsyQegfDNLoqYPYOZJgQSPabnIfY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)