UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XBm4zhibupaV4fvSVaM6NwtpG5imN7hLUjabN1EeEfI='
WHERE
key_id = '9a7d9a3b0e55fbc34e01f37bf86ff76e4f49eb54c97225e9030e962b25062837'
AND (
token = 'XBm4zhibupaV4fvSVaM6NwtpG5imN7hLUjabN1EeEfI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)