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