UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WXPDAxFxJEb3sZtVM0xyBtEWavWfuylgf1uAXfY+2yA='
WHERE
key_id = 'a7cc9c13a84c94104540475fe4d749d90a8eb7fea3ef60a3e81f1d8ed902d16b'
AND (
token = 'WXPDAxFxJEb3sZtVM0xyBtEWavWfuylgf1uAXfY+2yA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)