UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aQ104v+IGL3N4ueUncISSOpQa2usHeYM8R6bZZaAy2w='
WHERE
key_id = 'd295a0f61106228eaba038a5a4d2d39cdce5bc202be2c42f384b8cde4ced59d0'
AND (
token = 'aQ104v+IGL3N4ueUncISSOpQa2usHeYM8R6bZZaAy2w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)