UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wZQO+V8x+dDa8DJTYc4I5ajz62uscTxaHeB8WrxdXf0='
WHERE
key_id = '3146a49b936ba0f880e0c2126a7a07e3a0b0259c448540d1c8722ea6db52f697'
AND (
token = 'wZQO+V8x+dDa8DJTYc4I5ajz62uscTxaHeB8WrxdXf0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)