UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5VtP0dYY/enQNm4kICabxJyrJCIZCCngZNeF3S9YmVA='
WHERE
key_id = 'c6d6526b586be04d62cf7dc054536469b88d06b38c371e4f627762eaf1898094'
AND (
token = '5VtP0dYY/enQNm4kICabxJyrJCIZCCngZNeF3S9YmVA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)